import request from '@/utils/request'

export function getSupplierByPage(query) {
  return request({
    url: '/mall/api/manager/channel/supplier',
    method: 'get',
    params: query
  })
}

export function addSupplier(data) {
  return request({
    url: '/mall/api/manager/channel/supplier',
    method: 'post',
    data
  })
}

export function getSupplierById(id) {
  return request({
    url: '/mall/api/manager/channel/supplier/' + id,
    method: 'get'
  })
}

export function putSupplierById(id, data) {
  return request({
    url: '/mall/api/manager/channel/supplier/' + id,
    method: 'put',
    data
  })
}

export function deleteSupplierById(id) {
  return request({
    url: '/mall/api/manager/channel/supplier/' + id,
    method: 'delete'
  })
}

export function getSupplierDiscountByPage(query) {
  return request({
    url: '/mall/api/manager/channel/supplier/discount',
    method: 'get',
    params: query
  })
}

export function addSupplierDiscount(data) {
  return request({
    url: '/mall/api/manager/channel/supplier/discount',
    method: 'post',
    data
  })
}

export function getSupplierDiscountById(id) {
  return request({
    url: '/mall/api/manager/channel/supplier/discount/' + id,
    method: 'get'
  })
}

export function putSupplierDiscountById(id, data) {
  return request({
    url: '/mall/api/manager/channel/supplier/discount/' + id,
    method: 'put',
    data
  })
}

export function deleteSupplierDiscountById(id) {
  return request({
    url: '/mall/api/manager/channel/supplier/discount/' + id,
    method: 'delete'
  })
}

export function getSupplierSkuDiscountByPage(query) {
  return request({
    url: '/mall/api/manager/channel/supplier/sku-discount',
    method: 'get',
    params: query
  })
}

export function addSupplierSkuDiscount(data) {
  return request({
    url: '/mall/api/manager/channel/supplier/sku-discount',
    method: 'post',
    data
  })
}

export function getSupplierSkuDiscountById(id) {
  return request({
    url: '/mall/api/manager/channel/supplier/sku-discount/' + id,
    method: 'get'
  })
}

export function putSupplierSkuDiscountById(id, data) {
  return request({
    url: '/mall/api/manager/channel/supplier/sku-discount/' + id,
    method: 'put',
    data
  })
}

export function deleteSupplierSkuDiscountById(id) {
  return request({
    url: '/mall/api/manager/channel/supplier/sku-discount/' + id,
    method: 'delete'
  })
}

export function downloadSupplierSkuDiscount(param) {
  return request({
    url: '/mall/api/manager/channel/supplier/sku-discount/download',
    method: 'get',
    params: param,
    responseType: 'blob',
    timeout: 60000 * 5
  })
}

export function uploadSupplierSkuDiscount(param) {
  return request({
    url: '/mall/api/manager/channel/supplier/sku-discount/upload',
    method: 'post',
    data: param,
    timeout: 60000 * 5
  })
}

export function downloadSupplierSkuDiscountTemplate() {
  return request({
    url: '/mall/api/manager/channel/supplier/sku-discount/template',
    method: 'get',
    responseType: 'blob',
    timeout: 30000
  })
}

export function getSupplierDeliveryChargeByPage(query) {
  return request({
    url: '/mall/api/manager/channel/supplier/delivery-charge',
    method: 'get',
    params: query
  })
}

export function addSupplierDeliveryCharge(data) {
  return request({
    url: '/mall/api/manager/channel/supplier/delivery-charge',
    method: 'post',
    data
  })
}

export function getSupplierDeliveryChargeById(id) {
  return request({
    url: '/mall/api/manager/channel/supplier/delivery-charge/' + id,
    method: 'get'
  })
}

export function putSupplierDeliveryChargeById(id, data) {
  return request({
    url: '/mall/api/manager/channel/supplier/delivery-charge/' + id,
    method: 'put',
    data
  })
}

export function deleteSupplierDeliveryChargeById(id) {
  return request({
    url: '/mall/api/manager/channel/delivery-charge/' + id,
    method: 'delete'
  })
}
